using System;
using System.Collections.Generic;
using GGEditor.API;
using GGEditor.API.Plugins;

namespace GGEditor.Core.Editors
{
	[XmlNodeObjectFactory(Name = "Editor")]
	public class EditorDefinitionFactory : IXmlNodeObjectFactory
	{
		#region Implementation of IXmlNodeObjectFactory

		public object Build(IPluginNode pluginNode, IDictionary<string, string> attributes)
		{
			pluginNode.ChildAdded += OnChildAdded;
			pluginNode.ChildRemoved += OnChildRemoved;

			return new EditorDefinition()
			{
				Name = attributes["name"],
				Text = attributes["text"],
				ControllerType = ObjectCreator.FindType(pluginNode.Plugin.Assemblies, attributes["controller"]),
				ModelType = ObjectCreator.FindType(pluginNode.Plugin.Assemblies, attributes["model"]),
				ViewType = ObjectCreator.FindType(pluginNode.Plugin.Assemblies, attributes["view"])
			};
		}

		void OnChildAdded(IPluginNode node, IPluginNode child, int position)
		{
			throw new NotImplementedException();
		}

		void OnChildRemoved(IPluginNode node, IPluginNode child, int position)
		{
			throw new NotImplementedException();
		}

		#endregion
	}
}